﻿using ChholCmdPort;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChholConfig {
	public interface IPortUserUI {
		/// <summary>
		/// 设置图标
		/// </summary>
		Bitmap Bmp { get; }
		/// <summary>
		/// 设置文字
		/// </summary>
		string Port_text { get; }
		PortUserHandle Port_user{ get; }

		event EventHandler ePortNameChanged;
		event EventHandler eClosed;

		void showForm();
	}
	public static class IPortUserUI_export {
		public static string getPortName(this IPortUserUI cp) {
			if (cp.Port_user.Is_running) {
				return $"【端口{cp.Port_user.Port_id}】{cp.Port_text}";
			} else {
				return $"【停用】{cp.Port_text}";
			}
		}
	}
}
